<?php

namespace App\Services\spider;

use App\Model\CommonSpiderItem;

class HtmlResult
{
    public bool $success;
    public string $content;
    public int $html_code;

    public static function ofError(int $code=CommonSpiderItem::html_code_handle_error): HtmlResult
    {
        $item = new HtmlResult();
        $item->success = false;
        $item->html_code = $code;
        return $item;
    }

    public static function ofSuccess($content): HtmlResult
    {
        $item = new HtmlResult();
        $item->success = true;
        $item->content = $content;
        $item->html_code = CommonSpiderItem::html_code_success;
        return $item;
    }
}